import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    redirect:"/home"
  },
  {
    path: "/home",
    name: "Home",
    component: () => import("../views/Home.vue"),
    children: [
      {
        path: "/home",
        redirect:"/home/index"
      },
      {
        path: "/home/index",
        component: () => import("../views/index/Index.vue"),
      },
      {
        path: "/home/classify",
        component: () => import("../views/index/Classify.vue"),
      },
      {
        path: "/home/cart",
        component: () => import("../views/index/Cart.vue"),
      },
      {
        path: "/home/my",
        component: () => import("../views/index/My.vue"),
      },
    ],
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
